<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:mo="https://gitee.com/aun/Timo">

<body>
<style>
    .timo-detail-title{
        text-align: center;
        font-size: 18px;
        font-weight: 600 !important;
        color: #333 !important;
    }
    @media print {
        .layui-layout layui-layout-admin {
            display: none !important;
        }
    }
</style>
    <div class="timo-detail-page" id="printArea" style="padding: 20px">
        <th:block th:each="patient,iterStat :${patients}">
            <div class="timo-detail-title">医院陪护服务客户信息登记表</div>
            <table class="layui-table timo-detail-table">
                <tbody>
                <tr>
                    <th >服务对象姓名</th>
                    <td th:text="${patient.name}"></td>
                    <th >性别</th>
                    <td th:text="${#dicts.keyValue('USER_SEX', patient.sex)}"></td>
                    <th >出生日期</th>
                    <td th:text="${patient.birthDate}"></td>
                    <th >民族</th>
                    <td th:text="${patient.ethnicity}"></td>
                </tr>
                <tr>
                    <th>家庭住址</th>
                    <td colspan="3" th:text="${patient.homeAddress}"></td>
                    <th>身份证号码</th>
                    <td colspan="3" th:text="${patient.cardNo}"></td>
                </tr>
                <tr>
                    <th>户口所在地</th>
                    <td colspan="7" th:text="${patient.hukouLocation}"></td>
                </tr>
                <tr>
                    <th>生活自理情况</th>
                    <td colspan="7" ></td>
                </tr>
                <tr>
                    <th>病史</th>
                    <td colspan="7"  style="height: 200px;line-height: 1.8">
                        高血压：无口&nbsp;&nbsp;有口
                        &nbsp;&nbsp;&nbsp;&nbsp;老年痴呆：无口&nbsp;&nbsp;有口
                        &nbsp;&nbsp;&nbsp;&nbsp;慢性消化道疾病：无口&nbsp;&nbsp;有口<br>
                        冠心病：无口&nbsp;&nbsp;有口
                        &nbsp;&nbsp;&nbsp;&nbsp;中风后遗症：无口&nbsp;&nbsp;有口
                        &nbsp;&nbsp;&nbsp;&nbsp;食物药物过敏史：无口&nbsp;&nbsp;有口<br>
                        糖尿病：无口&nbsp;&nbsp;有口
                        &nbsp;&nbsp;&nbsp;&nbsp;骨折后遗症：无口&nbsp;&nbsp;有口
                        &nbsp;&nbsp;&nbsp;&nbsp;慢性支气管炎：无口&nbsp;&nbsp;有口<br>
                        传染病：无口&nbsp;&nbsp;有口
                        &nbsp;&nbsp;&nbsp;&nbsp;遗传病史：无口&nbsp;&nbsp;有口
                        &nbsp;&nbsp;&nbsp;&nbsp;其他（用文字表示）：无口&nbsp;&nbsp;有口<br>
                        男梗塞：无口&nbsp;&nbsp;有口
                        &nbsp;&nbsp;&nbsp;&nbsp;手术史：无口&nbsp;&nbsp;有口
                    </td>
                </tr>
                <tr>
                    <th>禁忌</th>
                    <td colspan="7" th:text="${patient.contraindications}" >-</td>
                </tr>
                <tr>
                    <th>婚姻状况</th>
                    <td th:text="${patient.maritalStatus}"></td>
                    <th>家庭人口（人）</th>
                    <td colspan="5" th:text="${patient.familyPopulation}"></td>
                </tr>
                <tr>
                    <th rowspan="2">监护联系人</th>
                    <th>姓名</th>
                    <td colspan="2" ></td>
                    <th rowspan="2">服务对象与监护联系人关系</th>
                    <td rowspan="2" colspan="3">配偶口&nbsp;&nbsp;&nbsp;&nbsp;子女口&nbsp;&nbsp;&nbsp;&nbsp;兄弟姐妹口<br>其他（用文字表示）：</td>
                </tr>
                <tr>
                    <th>联系人电话</th>
                    <td colspan="2"></td>
                </tr>
                <tr>
                    <th colspan="2">服务时间</th>
                    <td colspan="6"  ></td>
                </tr>
                <tr>
                    <th colspan="2">服务内容</th>
                    <td colspan="6"  ></td>
                </tr>
                <tr>
                    <th colspan="2">特殊要求</th>
                    <td colspan="6" ></td>
                </tr>
                <tr>
                    <th rowspan="5" colspan="2">配偶、子女情况</th>
                    <th>姓名</th>
                    <th>关系</th>
                    <th colspan="3">联系电话</th>
                    <td>备注</td>
                </tr>
                <tr>
                    <th></th>
                    <th>配偶</th>
                    <th colspan="3"></th>
                    <td></td>
                </tr>
                <tr>
                    <th></th>
                    <th>子女</th>
                    <th colspan="3"></th>
                    <td></td>
                </tr>
                <tr>
                    <th></th>
                    <th></th>
                    <th colspan="3"></th>
                    <td></td>
                </tr>
                <tr>
                    <th></th>
                    <th></th>
                    <th colspan="3"></th>
                    <td></td>
                </tr>
                </tbody>
            </table>
            <th:block th:unless="${iterStat.last}">
                <div class="page-break"></div>
            </th:block>
        </th:block>

    </div>
<script>
    $(function () {
        const content = document.getElementById('printArea').innerHTML;
        const newWindow = window.open('', '_blank');
        newWindow.document.write(`
    <html>
      <head>
        <title>打印</title>
        <style>
          /* 自定义打印样式 */
          body {
          font-family: Arial;

           }
           .layui-table {
                width: 100%;
                margin: 10px 0;
                background-color: #fff;
                color: #5f5f5f;
            }
            table {
                border-collapse: separate;
                text-indent: initial;
                border-spacing: 0px;
            }
            .layui-table td, .layui-table th{
                border-color: #f2f2f2;
                position: relative;
                padding: 9px 15px;
                min-height: 20px;
                line-height: 20px;
                border-width: 1px;
                border-style: solid;
                margin: 0;
                min-width: 50px;
                height: 30px;
                font-size: 12px;
            }
             .timo-detail-title{
                text-align: center;
                font-size: 18px;
                font-weight: 600 !important;
                color: #333 !important;
            }
            .page-break {
                page-break-before: always; /* 在此元素前分页 */
              }
        </style>
      </head>
      <body>${content}</body>
    </html>
  `);
        newWindow.document.close();
        newWindow.print();
        newWindow.close();
    })
</script>
</body>
</html>